package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
//import java.awt.Rectangle;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import com.tool.btn.FormsOnOffBtn;
import com.updateNew.MyIsif;



public class RoleResistanceJpanel extends JPanel {

    // 几个属性分类面板
    private FaShuKangXingJpanel[] shuXingJpanel;

    public RoleResistanceJpanel() throws Exception {
        if (MyIsif.getStyle().equals("水墨UI")) {
            this.setBackground(new Color(0, 0, 0, 0));
            this.setLayout(null);
            // setSize(new Dimension(290, 450));
            // 实力化面板
            shuXingJpanel = new FaShuKangXingJpanel[5];
            int hight = 0;
            for (int i = 0; i < shuXingJpanel.length; i++) {
                shuXingJpanel[i] = new FaShuKangXingJpanel(i + 1);
                shuXingJpanel[i].setOpaque(false);
                shuXingJpanel[i].setBounds(0, hight, 300, 20);
                hight += shuXingJpanel[i].getHeight();
                this.add(shuXingJpanel[i]);
            }
            this.setPreferredSize(new Dimension(300, hight));
        } else {
            this.setBackground(new Color(0, 0, 0, 0));
            this.setLayout(null);
            // setSize(new Dimension(290, 450));
            // 实力化面板
            shuXingJpanel = new FaShuKangXingJpanel[5];
            int hight = 0;
            for (int i = 0; i < shuXingJpanel.length; i++) {
                shuXingJpanel[i] = new FaShuKangXingJpanel(i + 1);
                shuXingJpanel[i].setOpaque(false);
                shuXingJpanel[i].setBounds(0, hight, 290, 24);
                hight += shuXingJpanel[i].getHeight();
                this.add(shuXingJpanel[i]);
            }
            this.setPreferredSize(new Dimension(290, hight));
        }
    }

    private ImageIcon icon;

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if (MyIsif.getStyle().equals("水墨UI")) {
            // 技能
            if (icon == null)
                icon = new ImageIcon("inkImg/newbackground/S207.png");

            g.drawImage(icon.getImage(), 0, 0, 300, 471, this);
        } else {
            // 技能
            if (icon == null)
                icon = new ImageIcon("inkImg/hongmu/2/kx_zj.png");

            g.drawImage(icon.getImage(), 0, 0, 290, 471, this);
        }

    }

    public FaShuKangXingJpanel[] getShuXingJpanel() {
        return shuXingJpanel;
    }

    public void setShuXingJpanel(FaShuKangXingJpanel[] shuXingJpanel) {
        this.shuXingJpanel = shuXingJpanel;
    }

    public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

}
